package com.ruoyi.laboratory.enums;

import com.ruoyi.common.core.utils.exptimpt.IExImportEnum;
import com.ruoyi.laboratory.domain.excel.LabResearchProjectExcel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.Assert;

/**
 * @author huangliang
 * @date 2024-10-22 17:11
 * @description 功能描述
 */
@AllArgsConstructor
@Getter
public enum ExImportBusinessEnum implements IExImportEnum {

    PROJECT("project", "科研项目", LabResearchProjectExcel.class, false),
    ;
    /**
     * 模块编码
     */
    private final String moduleCode;

    /**
     * 模块名称
     */
    private final String moduleName;

    /**
     * 模块名称
     */
    private final Class<?> excelClass;

    /**
     * 是否需要业务校验
     */
    private final Boolean businessVerification;

    /**
     * 根据模块编码获取枚举
     */
    @Override
    public IExImportEnum getEnumByModuleCode(String moduleCode) {
        IExImportEnum res = null;
        for (ExImportBusinessEnum exImportEnum : ExImportBusinessEnum.values()) {
            if (exImportEnum.getModuleCode().equals(moduleCode)) {
                res = exImportEnum;
            }
        }
        Assert.notNull(res, "此模块未实现导入导出功能");
        return res;
    }
}
